package com.bjsxt;

import com.bjsxt.service.EchoService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@RestController
public class DubboConsumerApplication {

    @Reference
    private EchoService echoService ;


    public static void main(String[] args) {
        SpringApplication.run(DubboConsumerApplication.class ,args) ;
    }

    @GetMapping("/rpc/{msg}")
    public ResponseEntity<String> rpc(@PathVariable("msg")String msg){
        String echo = echoService.echo(msg);
        return ResponseEntity.ok("远程调用成功，结果为:"+echo) ;
    }
}
